
#ifndef GROUPTREE_H
#define GROUPTREE_H

#pragma once
/////////////////////////////////////////////////////////////////////////////
// CGroupTree window
#include "ScrollBarEx.h"
class CGroupTree : public CTreeCtrl
{
// Construction
public:
	CGroupTree();
	virtual ~CGroupTree();
    void InitTree();
	bool isInited;
protected:
    int m_space;
    int m_ItemHeight;
// Attributes
public:
    void ScrollBarShow(bool isShow );
    INT SortItem(HTREEITEM hItem);
//public:
    void AddUserItem(WPARAM wParam);
    void EditUserItem(WPARAM wParam);
    void DeleteUserItem(WPARAM wParam);
    void AddTypeItem(WPARAM wParam);
    void EditTypeItem(WPARAM wParam);
    void MoveItem(WPARAM wParam);
    void DeleteTypeItem(WPARAM wParam);
    void AppointItem(WPARAM wParam);
    void UserJoin(WPARAM wParam);
    void UserCreate(WPARAM wParam);
    void UserApply(WPARAM wParam);
    void MoveTypeItem(WPARAM wParam);
    void Updata_JoinGroup(WPARAM wParam, LPARAM lParam);
    void Updata_GroupType(WPARAM wParam, LPARAM lParam);
protected:
    void DrawTitle(CDC *pDC,HTREEITEM hTreeItem,CRect rect);
    void DrawBack(CDC *pDC,int nItemState,CRect rect);
    void DrawFocusRect(CDC* pDC,LPCRECT lpRect);
    void DrawBmp(CDC *pDC,HTREEITEM hTreeItem,CRect rect,int flash);
    void DrawText(CDC *pDC,HTREEITEM hTreeItem,CRect rect);

    void On_Dblclk(HTREEITEM hItem);
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CGroupTree2)
	//}}AFX_VIRTUAL

// Implementation
public:

	// Generated message map functions
protected:
	virtual void PreSubclassWindow();
    COLORREF crBkColor;
    COLORREF crTextColor;
	//{{AFX_MSG(CGroupTree)
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
    afx_msg void OnCustomDraw(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnPaint();
	//}}AFX_MSG
private:
	CScrollBarEx m_HScroll;
	CScrollBarEx m_VScroll;
	DECLARE_MESSAGE_MAP()
};

#endif // GROUPTREE_H
